//
// Created by hps on 24-4-17.
//

#ifndef MARKDOWNPREVIEWBUTTON_H
#define MARKDOWNPREVIEWBUTTON_H

#include "HeadFiles.h"
#include "Config.h"

namespace hps {

class MarkDownPreviewButton: public QPushButton{
    Q_OBJECT
public:
Q_SIGNALS:
    void leftButtonClicked();

    void rightButtonClicked();

protected:
    void mousePressEvent(QMouseEvent *event) override {
        if (event -> button() == Qt::LeftButton) {
            emit leftButtonClicked();
        }
        else if (event -> button() == Qt::RightButton) {
            emit rightButtonClicked();
        }
        QPushButton::mousePressEvent(event);
    }

public:
    MarkDownPreviewButton();
    void init();
    void setUi();
private:
    QIcon* m_icon;
    std::string m_buttonText = "tabWidgetMDPreviewButton";
    ButtonName::Button m_buttonName = ButtonName::markdownPreview;
};

} // hps

#endif //MARKDOWNPREVIEWBUTTON_H
